﻿using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Data.SqlClient;
//51aspx源码专家
public partial class Default : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {

            this.GridView1.DataSource = sss("tb_Cargo");
            this.GridView1.DataBind();

            this.GridView2.DataSource = sss("tb_Truck");
            this.GridView2.DataBind();

            this.GridView3.DataSource = sss("tb_Chauffeur");
            this.GridView3.DataBind();

            this.GridView4.DataSource = sss("tb_OldTruck");
            this.GridView4.DataBind();

            this.GridView5.DataSource = sss("tb_Way");
            this.GridView5.DataBind();
        }
    }
    public DataTable sss(string tb)
    {
        string sql = "select top 8 * from " + tb + " where Auditing=1 order by id desc";
        SqlConnection strcon = Class1.DBconnection();
        strcon.Open();

        SqlDataAdapter sda =new SqlDataAdapter(sql, strcon);

        DataSet ds = new DataSet();
        sda.Fill(ds, tb);
        return ds.Tables[tb];
    }
}
